---
sidebar_position: 3
title: Guide - Payload
sidebar_label: Payload
---

# Payload

---

### Request data

Adding data to the requests is pretty simple. Use the `setData` method on the request and set whatever data you want to
transfer.

---

### Setting data for request

To set data of our request we need to use method `.setData()`.

```ts
const createUser = client.createRequest<ResponseType, DataType>()({ method: "POST", endpoint: "/users" });

const request = createUser.setData({ name: "Maciej" }); // Must match `DataType`
console.log(request.data); // Output: { name: "Maciej" }
```

#### Directly on send method

```ts
const response = await createUser.send({ data: { name: "Maciej" } }); // Must match `DataType`
```
